<?php
class Default_IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */

    }

    public function indexAction()
    {
       $boleto = new Application_Model_DbTable_Boleto();
        $totalBoleto = $boleto->fetchAll()->count();

        $this->view->totalBoleto = $totalBoleto;

        $select = $boleto->select()->from('boleto', array('sum(valor) as sum'));
        $valorBoletos = $boleto->fetchAll($select)->current()->toArray();

      //  $valorBoletos["sum"] = 10;

        if($valorBoletos["sum"]){
            $currency = new Zend_Currency(
                array(
                    'value'    => $valorBoletos["sum"],
                    'currency' => 'USD'
                )
            );
            $this->view->valorBoletos = $currency;
        }
        else{
            $this->view->valorBoletos = 'R$ 0,00';
        }

        

        $titudep = new Application_Model_DbTable_TituDep();
        $totalTituDep = $titudep->fetchAll()->count();
        $this->view->totalTituDep = $totalTituDep;

        $select = $titudep->select()->where('tipo = "D"');
        $totalDependente = $titudep->fetchAll($select)->count();
        $this->view->totalDependente = $totalDependente;

        $select = $titudep->select()->where('tipo = "T"');
        $totalTitular = $titudep->fetchAll($select)->count();
        $this->view->totalTitular = $totalTitular;
    }
}
?>
